package com.example.houduan.service;

import com.example.houduan.domain.Self_sb;
import com.example.houduan.domain.Self_sbExample;
import com.example.houduan.mapper.Self_sbMapper;
import com.example.houduan.resp.CommonResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Zzsbservice {
    @Autowired
    public Self_sbMapper self_sbMapper;
    public CommonResp add(Self_sb self_sb) {
        CommonResp commonResp =new CommonResp();
        int insert=self_sbMapper.insert(self_sb);
        if (insert==0)
        {
            commonResp.setContent(false);
            return commonResp;
        }else{
            commonResp.setContent(true);
            return commonResp;
        }
    }
    public CommonResp listall(String uid)
    {
        CommonResp commonResp=new CommonResp();
        Self_sbExample self_sbExample=new Self_sbExample();
        Self_sbExample.Criteria criteria=self_sbExample.createCriteria();
        criteria.andUidEqualTo(uid);
        List<Self_sb> self_sbs=self_sbMapper.selectByExample(self_sbExample);
        commonResp.setContent(self_sbs);
        return commonResp;
    }

}
